function check_top() {
    if(self==top) {
        old = window.location.href;
        url=old.split("/").pop();           //get the part of the url after the last slash which is the page name and all get parameters
        newurl = url.replace("?", "&");
        top.window.location.href = "main.php?page="+newurl;
    }
}
function resize_iframe()
{
    var main_iframe=top.document.getElementById("collabsoft");
    var nav=top.document.getElementById("nav");
    $(main_iframe).height(0);
    $(top.window).scrollTop(0);
    heightoffset=0;
    $(main_iframe).contents().find("*").each(function()
    {
        var newheightoffset=$(this).offset().top+$(this).height();
        if(newheightoffset>heightoffset)
        {
            heightoffset=newheightoffset;
        }
    });
     $(".footer").css("right", ($(window).width()/2)-100);
    $(main_iframe).height(heightoffset+100);
    if(parseInt($(nav).css("left"))<0)
        $(main_iframe).width($(top.window).width()*0.99);
    else
        $(main_iframe).width($(top.window).width()-$(nav).width());

}
